1. Technical Field
The invention relates to object-oriented programming languages. More particularly, the invention relates to a hardware accelerator for an object-oriented programming language.
2. Description of the Prior Art
Object-oriented programming (OOP) is the name of a class of programming languages and techniques based on the concept of an "object". An object is a self-contained component which has a specific role in a program. OOP languages include C++, and the Java language, developed by Sun Microsystems, Inc. For the purposes of discussion only, the OOP language described herein is Java.
An OOP defines classes of objects. A "class" is a prototype for an object, or a set of objects which share a common structure and behavior. An object, also referred to as an "instance", is a specific representation of a class. Each instance of a class is distinguished by its particular attributes. These attributes are defined by "instance variables". The types and names of these instance variables are defined in the class. However, the values of the instance variables are set and changed in the object.
The behavior of a class determines how an instance of that class operates. The behavior of a class is determined by a set of routines, referred to as "methods", that is associated with the class. An operation on an object is performed using a method. Methods are common to all instances of a particular class.
Classes are hierarchically arranged. Each class in the hierarchy may have a class above it in the hierarchy, referred to as a "superclass", or a class below it, referred to as a "subclass". Subclasses "inherit" attributes and behavior from their superclasses. Thus, a subclass does not have to redefine a behavior that is defined in a superclass, but can inherit the methods and variables from the superclass.
In an OOP, procedure calls are described in terms of message passing. A message names a method and may optionally include other arguments. When a message is sent to an object, the object's class is searched for the method named therein to determine how to perform the requested operation on the given object. If the method is not defined for the object's class, the object's superclass is searched. This procedure is continued up through the class hierarchy until either the method definition is found or there is no higher superclass to search.
The arrangement of arguments for a procedure call is determined by a calling convention. The calling convention determines the particular order in which arguments are pushed onto a stack or entered in registers, as well as who is responsible for removing the arguments.
The calling conventions, or interface, by which an application accesses an operating system and other services is referred to as the Application Programming Interface (API). In Java, the core Java API defines the minimal set of functionality that must be supported for a platform to be considered Java compliant.
Java Supports independent programs, referred to as applications, and dependent programs, referred to as applets. Java applets are programs that are transmitted over an electronic network and executed by an application provided on a receiving device. Examples of such electronic networks include the Internet, and a local area network system, referred to herein as an intranet. Receiving devices include computers, personal data assistants, and Internet-capable telephones.
For purposes of discussion herein, a Java applet will be assumed to be transmitted over the Internet to a receiving computer for display in a World Wide Web (Web) page. A Java application is a standalone program that does not need to be executed by an application, such as a Web browser provided on the receiving computer.
Java is a platform-independent language that can run on any Java compliant computer system. The Java development environment includes a Java compiler and a Java interpreter. The Java compiler generates bytecodes from a Java program. Java bytecodes are machine instructions that are not platform-specific.
A platform-specific bytecode interpreter is used to execute the Java program. This bytecode interpreter is called the Java virtual machine. For applets, the bytecode interpreter is built into a Java-enabled Web browser. The Java virtual machine and its supporting code are together referred to as the Java runtime system.
The Java virtual machine includes a bytecode instruction set, a set of registers, an area for storing methods, a stack, and a garbage-collected heap. The Java virtual machine registers temporarily hold the data representing the machine's state. The registers affect the machine's operation, and are updated after each bytecode is executed. The method area stores the Java bytecodes that implement most of the methods in the Java system.
The stack is used to supply parameters to both bytecodes and methods, and to receive back their results. The stack frame contains the local variables for the method call, its execution environment, and its operand stack.
The heap is the memory location from which newly-created instances are allocated. Instances are automatically "garbage-collected" in Java. A garbage collector is a programming function that is designed to track each instance that is created and to free the memory storing an instance after the last reference to the instance has vanished.
In Java, objects/classes that are intended to be reused repeatedly in different programs are stored as a "class library". A set of classes that embodies an abstract design for solutions to a number of related problems is known as a framework. The core application frameworks that are stored in the Java class library include Java.Lang, Java.Util, Java.Applet, Java.IO, Java.NET, and Java.AWT.
Java.Lang includes classes that add data types and system capabilities to the language itself, while Java.Util contains the utility classes and simple collection classes. Java.Applet contains classes for implementing Java applets.
Java.IO contains the input and output classes for writing to and reading from streams, such as standard input and output. Java.IO also includes the input and output classes for handling files.
Java.NET contains classes for networking support. Such classes include those for connecting and retrieving files in accordance with such standard Web protocols as, for example, TCP/IP and IP, and for creating sockets such as those used in UNIX applications.
The Java Abstract Windowing Toolkit (Java.AWT) provides classes and behavior for creating graphical user interface (GUI)--based applets and applications. The Java.AWT can be used, for example, to draw to the screen, create windows, buttons, menu bars, slider bars, and other user interface elements. Java.AWT can also be used to manage user input such as mouse clicks and keystrokes.
Object-oriented software frameworks are generally implemented using the computer's Random Access Memory (RAM), Read Only Memory (ROM), or Virtual Memory (VM). When a Java application or applet is started on, for example, a computer, one of the first operations performed is the creation of the GUI.
However, because a software-based implementation is being used, a significant percentage of the processing capacity of the computer operating system can be required to actually generate and display the GUI. Therefore, the processing of other instructions by the operating system can be slowed dramatically while GUI elements are being rendered on a display device. Further, if mouse or keyboard events are generated while a display is updating, the Java runtime may enter a kind of deadlock, where update events are being generated at the same time the system is trying to process backlogged mouse and keyboard events. Eventually the runtime system cannot catch up and process all events within a reasonable time frame. To an end-user the program appears to stop working, apparently refusing further commands and input.
Java is a multiprocess/multithreaded system. Thus, it supports a plurality of programs, or processes, executing simultaneously, each within its own address space. A thread is a sequence of code executing within one of these processes. Therefore, the Java programming environment and runtime system both have a multithreaded architecture.
In a multithreaded program such as Java, a single thread running a Java program may be blocked until, for example, a window is drawn. Additionally, any other thread that is dependant on that single thread can also be blocked. Blocking can restrict or delay, for example, information transmitted over a network. Blocking as such is defined as the capability for a Java thread to wait for a task to complete before resuming execution.
It is often desirable to run Java programs as a part of an embedded environment, for example to run Java applications and applets on a device such as an Internet-capable telephone. However, Java code and a fast Java bytecode processor are required to render the device Java compliant. This can significantly increase the costs of manufacturing and operating the device.
It would therefore be an advantage to provide a method and apparatus for reducing performance degradation. It would be yet another advantage if such method and apparatus permitted the efficient use of object-oriented programs in both embedded and desktop environments.